import { Component, OnInit } from '@angular/core';
import { Store } from '@ngxs/store';
import { RouterSelector } from '../../../store/router/router.selector';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../../shared/shared.module';
import { Service } from '../entity/service';

@Component({
  selector: 'app-service',
  standalone: true,
  imports: [CommonModule, SharedModule],
  template: `
      <nz-table #basicTable [nzData]="dataSet">
          <thead>
          <tr>
              <th>Name</th>
              <th>Age</th>
              <th>Address</th>
              <th>Action</th>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let data of basicTable.data">
              <td>{{ data.name }}</td>
              <td></td>
              <td></td>
              <td>
                  <a>Action 一 {{ data.name }}</a>
                  <nz-divider nzType="vertical"></nz-divider>
                  <a>Delete</a>
              </td>
          </tr>
          </tbody>
      </nz-table>
  `,
  styles: ``,
})
export class ServiceComponent implements OnInit {
  dataSet: Service[] = [];

  constructor(private store: Store) {
  }

  ngOnInit() {
    console.log('router params', this.store.selectSnapshot(RouterSelector.params));
  }
}
